﻿#region Using Directives

    using System;
    
    using Csla;

    using MarketPulse.BusinessLogic.Core;
using MarketPulse.BusinessLogic.Common.Criteria;

#endregion

namespace MarketPulse.BusinessLogic.Private
{
    /// <summary>
    /// This class represents a collection of visits that are made by a mystery shopper or exit 
    /// interviewer (for eaxmple) when conducting either a mystery shop or exit interview or other 
    /// survey. 
    /// </summary>
    [Serializable]
    [Csla.Server.ObjectFactory("MarketPulse.DataAccess.Factory.VisitFactory, MarketPulse.DataAccess.Factory", "FetchList")]
    public class VisitList : MarketPulseListBase<VisitList, Visit>
    {

        #region Constructors

            /// <summary>
            /// default constructor is private in order to (try to) enforce construction
            /// only via the static factory methods provided.
            /// </summary>
            private VisitList()
            {
            }

        #endregion

        #region Methods

            #region Factory Methods

                ///// <summary>
                ///// Method used to create a new collection of Visit objects via the DataPortal client proxy
                ///// </summary>
                ///// <returns>The newly created collection of visits</returns>
                //internal static VisitList New()
                //{
                //    return DataPortal.CreateChild<VisitList>();
                //}

                ///// <summary>
                ///// Method used to get a list of visits that are associated with a particular
                ///// round.
                ///// </summary>
                ///// <param name="id">The round Guid used to retrieve the visits</param>
                ///// <returns>The populated survey collection</returns>
                //internal static VisitList GetList(object childData)
                //{
                //    return DataPortal.FetchChild<VisitList>(childData);
                //}

                /// <summary>
                /// Method used to create a new collection of Visit objects (via the DataPortal client proxy)
                /// </summary>
                /// <returns>The newly created collection of Visit objects</returns>
                internal static VisitList New()
                {
                    return DataPortal.Create<VisitList>();
                }

                /// <summary>
                /// Method used to get a list of visits that are associated with a particular Round (via the DataPortal client proxy)
                /// </summary>
                /// <param name="roundGuid">The Round Guid used to retrieve the visit list</param>
                /// <returns>The populated list of visits</returns>
                internal static VisitList GetByRoundGUID(Guid roundGuid)
                {
                    return DataPortal.Fetch<VisitList>(new VisitCriteria(null, roundGuid, null, null));
                }

                /// <summary>
                /// Method used to get a list of visits that are associated with a particular Branch (via the DataPortal client proxy)
                /// </summary>
                /// <param name="branchGuid">The Branch Guid used to retrieve the visit list</param>
                /// <returns>The populated list of visits</returns>
                internal static VisitList GetByBranchGUID(Guid branchGuid)
                {
                    return DataPortal.Fetch<VisitList>(new VisitCriteria(null, null, branchGuid, null));
                }

                /// <summary>
                /// Method used to get a list of visits that are associated with a particular User (via the DataPortal client proxy)
                /// </summary>
                /// <param name="userGuid">The user Guid used to retrieve the visit list</param>
                /// <returns>The populated list of visits</returns>
                public static VisitList GetByUserGUID(Guid userGuid)
                {
                    return DataPortal.Fetch<VisitList>(new UserGUIDCriteria(userGuid));
                }

            #endregion

        #endregion
    }
}
